home *** CD-ROM | disk | FTP | other *** search
/ Apple Developer Connection Student Program / ADC Tools Sampler CD Disk 3 1999.iso / Metrowerks CodeWarrior / Java Support / Java_Source / Java2 / src / java / awt / Panel.java < prev    next >
Encoding:
Java Source  |  1999-05-28  |  2.1 KB  |  82 lines  |  [TEXT/CWIE]

  1. /*
  2.  * @(#)Panel.java    1.23 98/08/25
  3.  *
  4.  * Copyright 1995-1998 by Sun Microsystems, Inc.,
  5.  * 901 San Antonio Road, Palo Alto, California, 94303, U.S.A.
  6.  * All rights reserved.
  7.  *
  8.  * This software is the confidential and proprietary information
  9.  * of Sun Microsystems, Inc. ("Confidential Information").  You
  10.  * shall not disclose such Confidential Information and shall use
  11.  * it only in accordance with the terms of the license agreement
  12.  * you entered into with Sun.
  13.  */
  14. package java.awt;
  15.  
  16. import java.awt.peer.PanelPeer;
  17.  
  18. /**
  19.  * <code>Panel</code> is the simplest container class. A panel
  20.  * provides space in which an application can attach any other
  21.  * component, including other panels.
  22.  * <p>
  23.  * The default layout manager for a panel is the
  24.  * <code>FlowLayout</code> layout manager.
  25.  *
  26.  * @version     1.23, 08/25/98
  27.  * @author     Sami Shaio
  28.  * @see     java.awt.FlowLayout
  29.  * @since   JDK1.0
  30.  */
  31. public class Panel extends Container {
  32.     private static final String base = "panel";
  33.     private static int nameCounter = 0;
  34.  
  35.     /*
  36.      * JDK 1.1 serialVersionUID
  37.      */
  38.      private static final long serialVersionUID = -2728009084054400034L;
  39.  
  40.     /**
  41.      * Creates a new panel using the default layout manager.
  42.      * The default layout manager for all panels is the
  43.      * <code>FlowLayout</code> class.
  44.      */
  45.     public Panel() {
  46.     this(new FlowLayout());
  47.     }
  48.  
  49.     /**
  50.      * Creates a new panel with the specified layout manager.
  51.      * @param layout the layout manager for this panel.
  52.      * @since JDK1.1
  53.      */
  54.     public Panel(LayoutManager layout) {
  55.     setLayout(layout);
  56.     }
  57.  
  58.     /**
  59.      * Construct a name for this component.  Called by getName() when the
  60.      * name is null.
  61.      */
  62.     String constructComponentName() {
  63.         synchronized (getClass()) {
  64.         return base + nameCounter++;
  65.     }
  66.     }
  67.  
  68.     /**
  69.      * Creates the Panel's peer.  The peer allows you to modify the
  70.      * appearance of the panel without changing its functionality.
  71.      */
  72.  
  73.     public void addNotify() {
  74.         synchronized (getTreeLock()) {
  75.         if (peer == null)
  76.             peer = getToolkit().createPanel(this);
  77.         super.addNotify();
  78.     }
  79.     }
  80.  
  81. }
  82.